package com.qfedu.dao.impl;

import com.qfedu.dao.OrderDetailDao;
import com.qfedu.pojo.OrderDetail;
import com.qfedu.utils.DataSourceUtils;
import com.qfedu.utils.TxUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * 创建者: QF-SUN
 * 创建时间: 2023/4/6 14:48
 * 描述:
 */
public class OrderDetailDaoImpl implements OrderDetailDao {
    QueryRunner qr = new QueryRunner();

    @Override
    public void insert(OrderDetail orderDetail) {
        String sql = "INSERT INTO `tb_orderdetail`(`Oid`,`pid`,`num`,`Money`)VALUES(?,?,?,?)";
        try {
            qr.update(TxUtils.getConn(),sql, orderDetail.getOid(), orderDetail.getPid(), orderDetail.getNum(), orderDetail.getMoney());
        } catch (SQLException e) {
            e.printStackTrace();
            System.out.println("新增订单详情失败");
        }
    }
}
